package com.hr.service.impl;

import com.hr.dao.CommentsDao;
import com.hr.entity.Comments;
import com.hr.service.CommentsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/*
    Created with IntelliJ IDEA.
    @author: wang sir
    Date: 2021/7/19
    Time: 11:18
    To change this template use File | Settings | File Templates.
    Description: 
 */
@Service
public class CommentsServiceImpl implements CommentsService {
    @Autowired
    private CommentsDao commentsDao;
    @Override
    public List<Comments> queryAllCommentsByNid(Long nid) {
        return commentsDao.getAllByCnidOrderByCcreateDateDesc(nid);
    }

    @Override
    public Comments publishComments(Comments comments) {
        comments.setCcreateDate(new Date());
         return commentsDao.save(comments);
    }
}